<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>量化详细信息</title>
<link href="../css/bootstrap-cerulean.css" rel="stylesheet">
<link href="../css/charisma-app.css" rel="stylesheet">
<style type="text/css">
body {
	padding-bottom: 40px;
}

.sidebar-nav {
	padding: 9px 0;
}
</style>
	<script src="http://lib.sinaapp.com/js/jquery/2.2.4/jquery-2.2.4.min.js"></script>
	<script src="../js/common/public.js"></script>
	<script src="../js/base64.js"></script>
	<script src="../js/bootstrap-modal.js"></script>
	<script type="text/javascript">
		$(document).ready(function () {
			var urlMsg = parseUrl(window.location.search);
			$("#token").val(urlMsg.token);
			if (urlMsg.token != null) {
				var token = decode(urlMsg.token);
				token=token.substring(0,token.length-1);
			}
			var html = $.ajax({
				type: "GET",
				url: "http://localhost:1068/admin/class/findClassByClassNumber?token="+token+"&classNumber="+urlMsg.classNumber,
				async: false
			}).responseText;
			var result = eval('(' + html + ')');
			if (result.code != 200) {
				alert(result.msg)
			} else {
				$("#classNumber").html(result.data.classNumber);
				$("#className").html(result.data.className);
				$("#monitor").html(result.data.classNumber);
				$("#score").html(result.data.score);
				if (result.data.classScoreList!=null){
					for (index in result.data.classScoreList) {
						addClassScoreTable(result.data.classScoreList[index].id,result.data.classScoreList[index].classNumber,result.data.classScoreList[index].date,
								result.data.classScoreList[index].finallyScore,result.data.classScoreList[index].reason
								,result.data.classScoreList[index].page,result.data.classScoreList[index].operator);
						$('#editClassScore'+ result.data.classScoreList[index].id+'').attr('href','editClassScore.html?token='+urlMsg.token+'&id='+result.data.classScoreList[index].id+'&oldScore='+result.data.classScoreList[index].finallyScore);
					}
				}
			}
		});
		function addClassScoreTable(id,classNumber,date,finallyScore,reason,page,operator) {
			$("#classScoreList tbody").append("<tr class='odd'> " +
					"<td class=' sorting_1'>"+classNumber+"</td>" +
					"<td class='center '>"+date+"</td>" +
					"<td class='center '>"+finallyScore+"</td>" +
					"<td class='center '>"+reason+"</td>" +
					"<td class='center '>"+page+"</td>" +
					"<td class='center '>"+operator+"</td>" +
					"" +
					"<td class='center '>" +
					"<a id='editClassScore"+id+"' class='btn btn-info' href=''>" +
					"<i class='icon-edit icon-white'></i>  " +
					"编辑                                            " +
					"</a>" +
					"<a class='btn btn-danger' href='javascript:void(0);' onclick='deleteScore(id="+id+",this)';>" +
					"<i class='icon-trash icon-white'></i> " +
					"删除" +
					"</a>" +
					"</td>" +
					"</tr>");

		}

		function deleteScore(id,a) {
			if(window.confirm('删除操作不可逆，确定要删除吗？')){
				var urlMsg = parseUrl(window.location.search);
				$("#token").val(urlMsg.token);
				if (urlMsg.token != null) {
					var token = decode(urlMsg.token);
					token=token.substring(0,token.length-1);
				}
				var html = $.ajax({
					type: "DELETE",
					url: "http://localhost:1068/admin/classScore/deleteScore?token="+token+"&id="+id,
					async: false
				}).responseText;
				var result = eval('(' + html + ')');
				if (result.code != 200) {
					alert(result.msg)
				} else {
					alert("删除成功！")
					var score =   $("#score").html();
					$("#score").html(score-result.data);
					$(a).parent().parent().remove();
				}
			}else{
				// alert("取消");
				return false;
			}
		}
	</script>
</head>

<body>
	<div class="container-fluid"
		style="padding-left:0px;padding-right:2px;">
		<div class="row-fluid">
			<div id="content" class="span10" style="width:100%;">
				<div class="row-fluid sortable">
					<div class="box span12">
						<div class="box-header well">
							<h2>
								<i class="icon-user"></i>量化详细信息
							</h2>
						</div>
						<div class="box-content">
						
							<div id="DataTables_Table_0_wrapper" class="dataTables_wrapper">
								<table
									class="table table-striped table-bordered bootstrap-datatable datatable dataTable"
									id="classInfo">
									<thead>
										  <tr>
										  <th  class="sorting_asc" rowspan="1" colspan="1"  style="width: 15%">班级代号</th>
										  <th  class="sorting"   rowspan="1" colspan="1"  style="width: 25%">班级名称</th>
										  <th  class="sorting"   rowspan="1" colspan="1"  style="width: 10%">班长姓名</th>
										  <th  class="sorting"   rowspan="1" colspan="1"  style="width: 10%">量化总分</th>
										  </tr>
									 </thead>

									<tbody>
									  <tr class="odd">
											<td id="classNumber" class=" sorting_1"></td>
											<td id="className" class="center "></td>
											<td id="monitor" class="center "></td>
											<td id="score" class="center "></td>

										</tr>
									</tbody>
								</table>
								
								<table
									class="table table-striped table-bordered bootstrap-datatable datatable dataTable"
									id="classScoreList">
									
									<thead>
										  <tr>
										  <th class="sorting_asc"  rowspan="1" colspan="1"  style="width: 113px;">班级代号</th>
										  <th class="sorting_asc"  rowspan="1" colspan="1"  style="width: 113px;">申请日期</th>
										  <th class="sorting"  rowspan="1" colspan="1"  style="width: 45px;">分值</th>
										  <th class="sorting"  rowspan="1" colspan="1"  style="width: 331px;">原因</th>
										  <th class="sorting"  rowspan="1" colspan="1"  style="width: 83px;">页码</th>
										  <th class="sorting"  rowspan="1" colspan="1"  style="width: 83px;">操作者</th>
										  <th class="sorting"  rowspan="1" colspan="1"  style="width: 179px;">操作</th>
										  </tr>
									  </thead>   
									  
									  <tbody>

										</tbody>
								</table>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>